package com.example.idachuappone.person.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import com.example.idachuappone.promptly.dao.CookNoDao;
import com.example.idachuappone.promptly.dao.impl.CookNoDaoImpl;
import com.example.idachuappone.promptly.entity.CookNo;
import com.example.idachuappone.utils.CheckUtil;
import java.util.List;

public class CollectService extends Service {
    private CookNoDao cookNoDao;
    private List<CookNo> list;

    public IBinder onBind(Intent intent) {
        return null;
    }

    public void onCreate() {
        super.onCreate();
        this.cookNoDao = new CookNoDaoImpl(this);
    }

    public int onStartCommand(Intent intent, int flags, int startId) {
        this.list = this.cookNoDao.selectAll();
        if (!CheckUtil.checkNet(this)) {
            setCollect(-1);
        } else if (this.list != null && this.list.size() > 0) {
            addCollect(0);
        }
        return super.onStartCommand(intent, flags, startId);
    }

    public void addCollect(int i) {
    }

    public void onDestroy() {
        super.onDestroy();
    }

    public void setCollect(int id) {
        if (CheckUtil.checkNet(this)) {
            this.list = this.cookNoDao.selectAll();
            if (this.list != null && this.list.size() > 0) {
                addCollect(0);
                return;
            }
            return;
        }
        setCollect(-1);
    }
}
